import request from '../utils/request';

const url = 'http://localhost:8080/student';
export interface studentItemData
{
    studentId : number;
    studentName : string;
    studentIdentityId : string;
    studentSex : string;
    studentAge : number;
    studentPhone : string;
}

export const getAllStudent = () => {
    return request({
        url: url+'/getAllStudent',
        method: 'get',
    });
};

export const pageFindStudent = (page:number, size: number) => {
    return request({
        url: url+`/pageFindStudent?page=${page}&size=${size}`,
        // url: url+`/pageFindStudent`,
        method: 'get',
        // data : {page,size}
    });
};

export const updateStudent = (student : studentItemData) => {
    return request({
        url: url+`/updateStudent`,
        method: 'post',
        data : student,
    });
};

export const addStudent = (student : studentItemData) => {
    return request({
        url: url+`/addStudent`,
        method: 'post',
        data : student,
    });
};

export const getStudentByStudentId = (studentId : number) => {
    return request({
        url: url+`/getStudentByStudentId/`+studentId,
        method: 'get',
    });
};

export const filterStudent = (student : studentItemData) => {
    return request({
        url: url+`/filterStudent`,
        method: 'post',
        data : student,
    });
};

export const deleteStudent = (studentId : string) => {
    return request({
        url: url+`/deleteStudent/`+studentId,
        method: 'delete',
    });
};

export function fetchData() {
  throw new Error('Function not implemented.');
}
